package com.xiaohu.demo.dao.user;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.xiaohu.demo.dao.common.CommonDao;
import com.xiaohu.demo.entity.user.User;
import com.xiaohu.demo.utils.date.DateUtils;
import com.xiaohu.demo.utils.pageModel.PageModel;

@Repository
public class UserDao {
	private static Log logger = LogFactory.getLog(UserDao.class);
	
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	public void getAllUser(PageModel pageModel) {
		String sql = "select * from t_user ";
		pageModel.setSql(sql);
	}
	
	public List<Map<String,Object>> getUserList(){
		String sql = "select * from t_user ";
		return jdbcTemplate.queryForList(sql);
	}
	
	public List<Map<String,Object>> getUser(String username){
		String sql = "select * from t_user where login_name = ? ";
		return jdbcTemplate.queryForList(sql, username);
	}
	
	public List<Map<String,Object>> getUserList1(){
		String sql = "select * from t_user ";
		return jdbcTemplate.queryForList(sql);
	}
	
	
	public List<Map<String,Object>> getAllBedNo(){
		String sql = "select * from t_csm_bed_no ";
		return jdbcTemplate.queryForList(sql);
	}
	
	public void getDate() {
		logger.info("当前时刻："+ DateUtils.yyyyMMddHHmmss(new Date()));
	}
}
